$(function(){
    // 合伙人
    $("#partners").click(function(){
        $(".mask .tip").html("你想成为合伙人吗？请拨打客服电话与我们联系，确认拨打吗？")
        $(".mask").css("display","block");
        var btn=document.querySelector(".mask .btn");
        var mask=document.querySelector(".mask");
        btn.onclick=function(){
            var a=document.createElement("a");
            a.href="tel:4008257388";
            a.click();
            mask.style.display="none";
        }
    })
    init();
})
/**
 * 页面初始化
 */
function init(){
    var saleLevel=""; //用户等级
    $(".loding").show(0);
    var that=this;
    var userData=baseFunction.getUserInfo();
    var loginName = JSON.parse(JSON.parse(userData).user).loginName;
    var data={
        userName: baseFunction.encryption(loginName) ,
        queryType:"4610"
    }
    baseFunction.netRequest("param",data,function(res){
        $(".loding").hide(0);
        
        var data = JSON.parse(JSON.parse(res.data).result) ;
        saleLevel=data.saleLevel; //用户等级
        $("#totalAssets").html((data.account).toFixed(2));//总余额
        $("#accountBalance .p").html((data.account).toFixed(2));//账户余额
        $("#profitDistribution .p").html((data.profit).toFixed(2));//分润余额
        $("#promotionIncome .p").html((data.extension).toFixed(2));//推广余额
    })

    // 会员管理
    $("#memberManage").click(function(){
        window.location.href="my_memberManage.html?loginName="+loginName+""; 
    })
    // 总资产
    $(".head .p1,.head .p2").click(function(){
        baseFunction.verifyingRealName(function(){
            window.location.href="wallet_totalAssets.html?loginName="+loginName+"";
        })
        
    })
    // 账户余额
    $("#accountBalance").click(function(){
        baseFunction.verifyingRealName(function(){
            window.location.href="wallet_accountBalance.html?loginName="+loginName+"";
        })  
    })
    // 分润收益
    $("#profitDistribution").click(function(){
        baseFunction.verifyingRealName(function(){
            window.location.href="wallet_profitDistribution.html?loginName="+loginName+"&saleLevel="+saleLevel+"";
        })  
    })
     // 推广收益
    $("#promotionIncome").click(function(){
        baseFunction.verifyingRealName(function(){
            window.location.href="wallet_promotionIncome.html?loginName="+loginName+"&saleLevel="+saleLevel+"";
        })
    })
    // 订单记录
    $("#orderRecord").click(function(){
        window.location.href="wallet_orderRecord.html?loginName="+loginName+"";
    })

}